package com.example.config;


import com.example.interceptor.DomeInterceptor;
import com.example.interceptor.TokenInserceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * WebConfig 类的描述信息  注册拦截器
 *
 * @author 12427
 * @since 2025/6/8 12:12
 */
//@Configuration//配置类
public class WebConfig implements WebMvcConfigurer {
//    @Autowired
//    private DomeInterceptor domeInterceptor;

//    @Override//添加拦截器
//    public void addInterceptors(InterceptorRegistry registry) {
////   拦截器 由spring提供de    inserceptor  拦截器
//        registry.addInterceptor(domeInterceptor).addPathPatterns("/**");
//    }

    @Autowired
    private TokenInserceptor tokenInserceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        token
        registry.addInterceptor(tokenInserceptor).addPathPatterns("/**");
    }
}
